<script setup lang="ts">
import { ref, watch, watchEffect } from 'vue';

const count = ref(0)
const money = ref(1000)

// watch
// watch([count, money], (newVal) => {
//     console.log(newVal)
// } ,{ immediate : true
// })

// watchEffect() 
// watchEffect会立即执行一次
watchEffect(() => {
    console.log(count.value, money.value)
})
</script>

<template>
    <div>数值 : {{count}}</div>
    <button @click="count++">count加1</button>
    <div>money : {{money}}</div>
    <button @click="money--">money减1</button>
</template>